#include<stdio.h>
#include<iostream>
#include <sys/types.h>
#include <sys/wait.h>
using namespace std;
int main()
{
    pid_t pid = fork();
    if (pid == 0)
    {
        cout<<"i am child process"<<endl;
	    sleep(5);
        return 2;
    }
    else if(pid > 0)
    {
	int status;
    waitpid(pid,&status,0);
	cout<<"exit_code: "<<((status>>8)&0xFF)<<endl;
	cout<<"exit_signal: "<<(status&0x7F)<<endl;
    }

    return 0;
}
